package com.harmontronics.hanma.paas.paas.domain.app.entity;


import java.time.LocalDateTime;


import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.harmontronics.hanma.paas.paas.domain.app.entity.valueobject.I18nKeyEnum;
import com.harmontronics.hanma.paas.paas.exception.ErrorKeyException;

import lombok.Data;

/**
 * ${comments}
 *
 * @author paas-generator
 * @email paas-generator@harmontronics.com
 * @date 2021-04-02 10:54:59
 */
@Data
public class HmProcess {

    /**
     * $column.comments
     */
    private Long id;
    /**
     * 流程名称
     */
    private String name;
    /**
     * 流程KEY
     */
    private String key;
    /**
     * 版本号
     */
    private Integer version;
    /**
     * 流程描述
     */
    private String description;
    /**
     * 创建人
     */
    private String createBy;
    /**
     * 创建时间
     */

    private LocalDateTime createDate;
    /**
     * 更新人
     */
    private String modifyBy;
    /**
     * 更新时间
     */
    private LocalDateTime modifyDate;
    /**
     * 所属文件夹
     */
    private Long folderId;

    /**
     * 所属文件夹
     */
    private  String folderName;
    /**
     * 激活的
     */
    private Integer activated;
    /**
     * 管理业务模型
     */
    private String modelCode;

    /**
     * 流程定义的json
     */
    private String json;

    /**
     * 部署ID
     */
    private String deploymentId;

    private Integer published;


    public void checkActivated() {
        if (this.activated != 1) {
            throw new ErrorKeyException(I18nKeyEnum.PROCESS_NOT_ACTIVATED_ERROR);
        }
    }

}
